<?php
/**
 * session model class
 *
 * @author raphael seebacher <raphasee@ee.ethz.ch>
 * @version 0.01
 */
class session extends model {
    protected static $instance = NULL;

    protected function construct() {
        // session_save_path($_SERVER['DOCUMENT_ROOT'].'../data/sessions');
        // session_start();
    }

    protected function __clone() {

    }

    public static function get_instance() {
        if (self::$instance == NULL) {
            self::$instance = new self();
        }

        return self::$instance;
    }

    public function clear() {
        session_destroy();
    }

    public function set($key, $value) {
        return ($_SESSION[$key] = $value);
    }

    public function remove($key) {
        unset($_SESSION[$key]);
    }

    public function get($key) {
        if (array_key_exists($key, $_SESSION)) {
            return $_SESSION[$key];
        }

        return NULL;
    }
}
?>